package com.yy.tools.menu
{
	import flash.display.Sprite;
	import flash.events.ContextMenuEvent;
	import flash.events.MouseEvent;
	import flash.net.URLLoader;
	import flash.net.navigateToURL;
	import flash.text.TextField;
	import flash.ui.ContextMenu;
	import flash.ui.ContextMenuBuiltInItems;
	import flash.ui.ContextMenuItem;
	
	/**
	 * 修改显示对象右键内容
	 * @author YY
	 * 
	 */
	public class Menu
	{
		public var contextMenu:ContextMenu;
		public function Menu(obj:Object)
		{
			contextMenu = new ContextMenu();
			//删除原始菜单状态!
			contextMenu.hideBuiltInItems();
			obj.contextMenu = contextMenu;
		}
		
		/**
		 * 添加菜单项  
		 * @param item
		 * 
		 */
		public function addMenuItem(item:ContextMenuItem):void {
			contextMenu.customItems.push(item);
		}
		
		/**
		 * 通过字符串添加菜单 
		 * @param str
		 */
		public function addStrMenu(str:String):void {
			contextMenu.customItems.push(new ContextMenuItem(str));
		}
	}
}